home *** CD-ROM | disk | FTP | other *** search
- bat * utility seminar driver
- bat %1 = 0
- bat %m = 13
- bat -nextpage
- bat %1 = %1 + 1
- bat call -header
- bat call -page%1
- bat type | inkey %2
- bat if %2 = D exit
- bat if %1 <> %m skip 1
- fskel
- bat if %2 <> E goto -nextpage
- c:
- ft
-
- bat -header cls
- bat begtype
- ╔════════════════════════════════════════════════════════════════════════════╗\0F
- end
- bat type %s%s Utilities Seminar %s%s%s DOS BATCH FACILITY %s%s%s%s Page %1
- bat begtype
- ╚════════════════════════════════════════════════════════════════════════════╝
-
- end
- bat return
-
- bat -page1
- bat begtype
- \0fDOS COMMANDS\07
-
- A DOS command is...
-
- How you tell the computer what you want to do.
-
- The operating system prompts you for commands with
-
- A>
-
- You respond by typing
-
- DIR to get a list of the files on drive A
-
- 123 to execute the spread sheet 123
-
- format b:/s/v to format a disk on drive B, put the
- DOS operating system on it, and
- put an internal label on the disk
- end
- bat return
-
- bat -page2 begtype
- \0fDOS COMMANDS\07
-
- A DOS command is...
-
- any executable program that can be invoked, including
-
- o internal DOS commands
- o programs ending with .EXE
- o programs ending with .COM
-
- plus
-
- o A collection of executable programs.
-
- A BATCH of executable programs is
-
- o A list of things for DOS to do
-
- o A file identified by the extension .BAT
- end
- bat return
-
- bat -page3
- bat begtype
- \0fBATCH FILES\07
-
- Think of a BATCH FILE as
-
- Having stored your keystrokes.
-
- You can re-invoke those keystrokes anytime by
-
- Using the file name.
-
- For example, if the file CHECK.BAT contains in it
-
- astclock
- chkdsk a:
- dir *.com
-
- By typing in just "CHECK" all three programs will be executed,
- one after the other.
- end
- bat return
-
- bat -page4
- bat begtype
- \0FHOW TO CREATE A BATCH FILE\07
-
- Short "quick" and "dirty" files can be created by
-
- Copying the console to a file name.
-
- For example, the DOS command
-
- copy con: test.bat<rtn>
- astclock<rtn>
- chkdsk a:<rtn>
- dir *.com<rtn>
- <ctrl-Z><rtn>
-
- will create the desired file.
-
- To create longer files, however, use any TEXT EDITOR, such as
-
- EDLIN, PERSONAL EDITOR, PEDIT, or WORDSTAR in non-document mode.
- end
- bat return
-
- bat -page5 begtype
- \0fUSES OF THE BATCH FACILITY\07
-
- The batch facility can be used to
-
- o SIMPLIFY DOS commands
-
- o Increase PRODUCTIVITY by
-
- o Reducing keystrokes
-
- o Reducing human errors
-
- o Making the computer run unattended
-
- o Program how the computer INTERACTS with humans. You can
-
- o Make the computer easier to use
-
- o Reduce the amount of knowledge the user needs.
- end
- bat return
-
- bat -page6 begtype
- \0fEXAMPLE: KEEP IT SIMPLE!\07
-
- INSTALLING AN ELECTRONIC DRIVE
-
- superdrv c:/u=128/m=130
-
- MEANS
- o Run program SUPERDRV.COM
- o Set up electronic drive as C
- o Set aside 128K RAM for user programs
- o Set aside 130K RAM for electronic disk.
-
- PROBLEMS
-
- o Insists on rigid syntax
- o Parameters easy to forget
- o Frequent references to manual
-
- SOLUTION Store above DOS command in file SDRV.BAT.
- end
- bat return
-
- bat -page7 begtype
- \0fDO IT ALL AT ONCE\07
-
- GETTING STARTED WHEN YOU BOOT UP
-
- o Set time and date
- o Cause screen to clear after 5 minutes inactivity
- o Install electronic drive
- o Copy editor into electronic drive
-
- Want all this to happen AUTOMATICALLY when I boot up.
-
- SOLUTION Special BATCH file called AUTOEXEC.BAT.
-
- So, create AUTOEXEC.BAT with
-
- astclock
- colblank
- superdrv c:/u=128/m=130
- copy a:pedit.exe c:pe.exe
- end
- bat return
-
- bat -page8 begtype
- \0fREPETITION: PROGRAM-TEST-MODIFY CYCLE\07
- ---------- ----------
- | | ------------> | |
- | EDIT | | TEST |
- | | <------------ | |
- ---------- ----------
-
- In developing this seminar presentation, I
-
- o Created a file called UTILSEM.BAT
- o Tested the program UTILSEM
- o Revised UTILSEM.BAT, based on test results
- o Re-tested program.
-
- To make cycle natural, created two utility files.
-
- FT.BAT pe b:utilsem.bat UTILSEM.BAT (went thru seminar)
- b: c:
- utilsem ft
- end
- bat return
-
- bat -page9 begtype
- \0fSPECIAL BATCH COMMANDS\07
-
- Two types of lines in a batch file:
-
- o Executable programs
-
- o Special batch commands.
-
-
- SPECIAL NEEDS SOLUTION
- -------------------------------------------------------------------------
- o Put up messages to operator | REM, ECHO
- |
- o Wait for operator to do something | PAUSE
- |
- o Vary what is executed | (variables), IF, GOTO
- --------------------------------------------------------------------------
-
- Note: ECHO, IF, GOTO are available only in DOS 2.0/2.1, not 1.1.
- end
- bat return
-
- bat -page10 begtype
- \0fBATCH FILES WITH PARAMETERS\07
-
- Suppose you wanted to install the electronic drive, but be able to
-
- o Vary the amount of memory on the drive.
-
- SOLUTION Invoke with ARGUMENTS or PARAMETERS. For example
-
- superdrv c:/u=128/m=%1
-
- INVOKE SDRV.BAT by sdrv 80 WILL GET superdrv c:/u=128/m=80
-
- Another example is invoking a spelling checker, telling it which file:
-
- PRFPASS1 B:%1
- PRFPASS2 B:%1c
- end
- bat return
-
- bat -page11 begtype
- \0fINSTALLATION PROGRAMS\07
-
- NEED: To automate installation of a program. Steps are
-
- o Put DOS in left drive and program in right
- o Transfert DOS system files and BASIC onto program disk
- o Put appropriate drivers onto program disk for monitor used.
-
- SOLUTION: an INSTALL.BAT with printed instructions telling the person to
- boot using DOS 2.0, to put the program disk in drive B, to type B: followed
- by return , and to type INSTALL with return.
-
- The basic structure of the batch program is
-
- o Tell the user exactly what to do
- o Give the user time to do it
- o When the user is ready, check to see whether done properly
- o If okay, install; if not, let know and cancel
- end
- bat return
-
- bat -page12 begtype
- \0fSAMPLE INSTALLATION PROGRAM\07
-
- ECHO OFF
- ECHO Run this installation program once.
- ECHO Please put your DOS 2.0 disk in the left drive A.
- PAUSE
- IF NOT EXIST A:SYS.COM GOTO QUIT
- ECHO Now put your system disk in the right drive B.
- PAUSE
- IF NOT EXIST B:BARBAIL.EXE GOTO QUIT
- A:SYS B:
- Copy A:BASICA.COM B:
- ECHO To complete installation,
- ECHO enter COLOR if you have a COLOR MONITOR
- ECHO enter MONO if you have a MONOCHROME MONITOR.
- GOTO GOODEX
- :QUIT
- ECHO Improper disk in drive.
- :GOODEX
- end
- bat return
-
- bat -page13 begtype
- \0FLIMITATIONS\07
-
- The BATCH facility built into DOS is limited in what it
- can do. The most serious limitations are that it
-
- o Cannot read input from the user
- o Cannot assign values to variables.
- o Cannot control or drive .EXE or .COM programs.
-
- These limitations are removed in a freeware product called The Extended
- Batch Language. This entire demonstation was written in EBL in one evening.
-
- EBL can be gotten free on bulletin boards, or for a contribution of $5 to
- its author for software only, or $30 for printed documentation, support, and
- updates. The address is
- Seaware Corporation
- P.O. Box 1656
- Delray Beach, Florida 33444
- end
- bat return
-